package com.example.authservice.controller;

import com.alibaba.fastjson.JSONObject;
import com.example.api.service.OpenApiAppService;
import com.example.common.constant.ApiParamConsts;
import com.example.common.core.AjaxResult;
import com.example.common.entity.vo.AppInfoVO;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author DestinyCc
 * @date 2022/4/15
 */
@RequestMapping("/app")
@Slf4j
@RestController
public class ApiAppController {

    @Reference
    @LoadBalanced
    OpenApiAppService openApiAppService;

    /**
     * 申请创建开放平台的自建应用
     *
     * @param email
     * @return
     */
    @GetMapping("/create")
    public AjaxResult create(@RequestParam(value = ApiParamConsts.EMAIL) String email) {
        return AjaxResult.success(openApiAppService.createApp(email));
    }
}
